package com.bdqn.easybuy1.param;

import com.bdqn.easybuy1.entities.News;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class NewsParams extends News {
    /**
     * 开始索引，数据库查询的开始索引，从0开始
     */
    private Integer startIndex;
    /**
     * 每页显示数据条数
     */
    private Integer pageSize;
    /**
     * 排序字段
     */
    private String sort;
    /**
     * 是否分页
     */
    private boolean isPage = false;

    /**
     * 开启分页
     *
     * @param startIndex 开始索引
     * @param pageSize   每页显示的数据条数
     */
    public void openPage(Integer startIndex, Integer pageSize) {
        this.isPage = true;
        this.startIndex = startIndex;
        this.pageSize = pageSize;
    }
}
